﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/AvalonDock;component/themes/generic.xaml"/>
        <ResourceDictionary Source="/AvalonDock;component/themes/aero.normalcolor.brushes.xaml"/>
        <ResourceDictionary Source="Shared.xaml" />
        <ResourceDictionary Source="DockablePane.xaml" />
        <ResourceDictionary Source="DockingManager.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!--DocumentTabItemStyle-->
    <Style x:Key="DocumentTabItemStyle" TargetType="{x:Type ad:ManagedContent}">
        <Setter Property="Background"
                Value="Transparent"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ad:ManagedContent}">
                    <Border 
						x:Name="PART_DragArea" 
						BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}"
                        Margin="-10,0,0,0"
						SnapsToDevicePixels="True"
                        ContextMenu="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:ContextMenuElement.DocumentPane}}}">
                        <Border
                                    x:Name="tabItemIntBorder"
                                    Grid.Column="0"
                                    BorderThickness="0"
                                    Margin="0,0,0,0"
                                    CornerRadius="0,0,0,0"
                                    BorderBrush="Blue"
                                    Background="Green">
                            <StackPanel Orientation="Horizontal" Margin="5,0,4,0">
                                <TextBlock 
							            x:Name="tabItemTitle" 
							            TextTrimming="CharacterEllipsis" 
                                        TextWrapping="NoWrap"
							            Text="{TemplateBinding Title}" 
							            Margin="5,0,4,0"  
							            Foreground="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderForeground}}}"/>
									<ad:AlignedImage x:Name="PART_LockedIcon" Margin="2,0,0,0" Visibility="Collapsed" VerticalAlignment="Center" HorizontalAlignment="Center">
										<Image Source="/AvalonDock;component/resources/Images/Locked.png" Width="6" Height="8" Stretch="Uniform"/>
									</ad:AlignedImage>
								</StackPanel>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Selector.IsSelected" Value="True">
                            <Setter Property="Background" 
                                    TargetName="tabItemIntBorder" 
                                    Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundSelected}}}"
                                    />
                        </Trigger>
                        <DataTrigger Binding="{Binding Path=IsActiveDocument, RelativeSource={RelativeSource Self}}" Value="True">
                            <Setter Property="TextBlock.FontWeight" TargetName="tabItemTitle" Value="Bold"/>
                        </DataTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" SourceName="tabItemIntBorder" Value="True"/>
                                <Condition Property="Selector.IsSelected" Value="False"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" 
                                    TargetName="tabItemIntBorder" 
                                    Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundMouseOver}}}"
                                    />
                        </MultiTrigger>
                        <DataTrigger Binding="{Binding Path=IsLocked, RelativeSource={RelativeSource Self}}" Value="True">
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_LockedIcon"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--DocumentPane-->
    <Style TargetType="{x:Type ad:DocumentPane}">
        <Setter Property="Background" Value="{StaticResource Brush_WindowBackground}"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ad:DocumentPane}" >
                    <ControlTemplate.Resources>
                        <ContextMenu x:Key="DocumentsListMenu" StaysOpen="True" >
                            <ContextMenu.ItemContainerStyle>
                                <Style TargetType="{x:Type MenuItem}">
                                    <Setter Property="CommandParameter" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Header}"/>
                                    <Setter Property="Command" Value="ad:DocumentPane.ActivateDocumentCommand"/>
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="MenuItem">
                                                <Border x:Name="intBorder" BorderThickness="1" Background="{StaticResource Brush_ControlBackground}" CornerRadius="2">
                                                    <Grid>
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition Width="Auto" MinWidth="24"/>
                                                            <ColumnDefinition Width="*"/>
                                                        </Grid.ColumnDefinitions>
                                                        <ContentPresenter x:Name="Icon" Margin="2" Content="{Binding Path=Icon}" Grid.Column="0" VerticalAlignment="Center"/>
                                                        <TextBlock x:Name="intMenuTitle" Foreground="{DynamicResource InversedTextBrush}" Margin="5,2,20,2" Text="{Binding Path=Title}" Grid.Column="1" VerticalAlignment="Center"/>
				                                    </Grid>
                                                </Border>
                                                <ControlTemplate.Triggers>
                                                    <Trigger Property="IsMouseOver" Value="true">
                                                        <Setter Property="Background" TargetName="intBorder">
                                                            <Setter.Value>
                                                                <SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveCaptionColorKey}}" Opacity="0.3"/>
                                                            </Setter.Value>
                                                        </Setter>
                                                        <Setter Property="BorderBrush" TargetName="intBorder" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}"/>
                                                    </Trigger>
                                                    <DataTrigger Binding="{Binding Path=IsActiveDocument}" Value="True">
                                                        <Setter Property="FontWeight" Value="Bold" TargetName="intMenuTitle"/>
                                                    </DataTrigger>
                                                </ControlTemplate.Triggers>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ContextMenu.ItemContainerStyle>
                        </ContextMenu>
                    </ControlTemplate.Resources>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <ContentPresenter 
                                    Grid.Row="1"
                                        Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}"
                                        Margin="1"
								        KeyboardNavigation.TabNavigation="Local"
								        KeyboardNavigation.DirectionalNavigation="Contained"
								        KeyboardNavigation.TabIndex="1"
                                        />
                        <DockPanel x:Name="PART_Header" 
							    Grid.Row="0" LastChildFill="True">
                            <Button DockPanel.Dock="Right" Width="18" Height="18" Style="{StaticResource PaneHeaderCommandStyle}" Command="ApplicationCommands.Close">
                                <ad:AlignedImage>
                                    <Image Source="/AvalonDock;component/resources/Images/PinClose.png" Width="13" Height="13" Stretch="Uniform"/>
                                </ad:AlignedImage>
                            </Button>
                            <Button x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Width="18" Height="18" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DocumentPane.ShowDocumentsListMenuCommand">
                                <ad:AlignedImage>
                                    <Image x:Name="ShowContextMenuIcon" Source="/AvalonDock;component/resources/Images/PinMenu.png" Width="13" Height="13" Stretch="Uniform"/>
                                </ad:AlignedImage>
                            </Button>
                            <ad:DocumentTabPanel 
                                        x:Name="paneTabsPanel" 
                                        Panel.ZIndex ="1" 
                                        KeyboardNavigation.TabIndex="2"								
								        IsItemsHost="True" 
								        Margin="10,2,0,0"
                                        TabItemStyle="{StaticResource DocumentTabItemStyle}"/>
                        </DockPanel>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasItems" Value="False">
                            <Setter Property="Visibility" Value="Hidden"/>
                        </Trigger>
                        <DataTrigger Binding="{Binding Path=IsMainDocumentPane, RelativeSource={RelativeSource Self}}" Value="True">
                            <Setter Property="Source" Value="/AvalonDock;component/resources/Images/PinDocMenu.png" TargetName="ShowContextMenuIcon"/>
                        </DataTrigger>
                        <EventTrigger RoutedEvent="Window.Loaded">
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation
                                        Storyboard.TargetProperty="Opacity"
                                        From="0" To="1"  Duration="0:0:0.200" />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>